feat: Add topic SqlFilterCount and CorrelationFilterCount runtime properties - #50022
Conversation
…perties - Add getSqlFilterCount() and getCorrelationFilterCount() to TopicRuntimeProperties, exposing the total number of SQL and correlation filters across all of a topic's subscriptions - Add ServiceBusServiceVersion.V2024_05 and make it the latest; the administration client now sends api-version=2024-05 by default, which the topic filter counts require - Parse SqlFilterCount/CorrelationFilterCount ATOM elements onto TopicDescription and default to 0 when absent (older region or api-version) - Add a swagger codegen directive so a regeneration reproduces the two fields instead of dropping them - Add unit tests (service-version default and mapping, propagate and default-to-zero, XML round-trip) and a live integration test asserting the counts
…pic-filter-counts-37720586 # Conflicts: # sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md
There was a problem hiding this comment.
Pull request overview
This PR extends the Azure Service Bus administration client to surface topic-level runtime counts for SQL and correlation filters, and updates the default administration api-version to 2024-05 to enable the service to return these new fields.
Changes:
- Added
sqlFilterCountandcorrelationFilterCountplumbing from generatedTopicDescription→TopicProperties→ publicTopicRuntimeProperties. - Introduced
ServiceBusServiceVersion.V2024_05and made it the default/latest service version. - Added unit and live integration coverage for version mapping, runtime-property propagation/defaulting, and XML serialization/deserialization.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| sdk/servicebus/azure-messaging-servicebus/swagger/README.md | Injects SqlFilterCount / CorrelationFilterCount into TopicDescription via an AutoRest directive for the pinned swagger. |
| sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/ServiceBusServiceVersionTest.java | Verifies latest version selection and enum → api-version string mapping. |
| sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/ServiceBusManagementSerializerTest.java | Adds XML round-trip test coverage for the new topic filter-count elements. |
| sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/administration/TopicRuntimePropertiesTest.java | Validates propagation to public TopicRuntimeProperties and default-to-zero behavior when absent. |
| sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/administration/ServiceBusAdministrationClientIntegrationTest.java | Adds a live-only test that creates rules and validates the returned topic-level filter counts. |
| sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusServiceVersion.java | Adds V2024_05 and updates getLatest() to return it. |
| sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/administration/models/TopicRuntimeProperties.java | Adds public getters for SQL/correlation filter counts. |
| sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/administration/models/TopicProperties.java | Captures filter counts from TopicDescription and exposes internal getters for runtime model construction. |
| sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/administration/implementation/models/TopicDescription.java | Adds generated fields, XML (de)serialization, and accessors for the new counts. |
| sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md | Documents the new runtime properties and service-version default change. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
Suppressed comments (1)
sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/administration/ServiceBusAdministrationClientIntegrationTest.java:552
- This integration test is currently gated to
TestMode.LIVEonly, so it will be skipped in bothRECORD(when recordings are created) andPLAYBACK(the default CI mode for proxy-based tests). That makes the test effectively non-executing in normal runs and increases the risk that it silently breaks over time.
Consider allowing RECORD as well (recordings can be captured from a feature-enabled namespace), and optionally later enabling PLAYBACK once a stable recording exists.
assumeTrue(super.getTestMode() == TestMode.LIVE, "Filter counts require a live feature-enabled namespace.");
The default administration api-version is now 2024-05 (getLatest()), which the recorded playback tests would send, but their session recordings were captured at 2021-05, so the test proxy could not match the requests. - Pin the recorded (playback/record) modes to ServiceBusServiceVersion.V2021_05 in the shared configure() and the impl-client and unauthorized-client builders; live mode keeps the latest default. - Mark getTopicFilterCounts with @liveonly so it skips cleanly in playback (it needs the 2024-05 default and a feature-enabled live namespace, and has no recording), instead of failing setup on a missing recording.
|
Azure Pipelines: Successfully started running 1 pipeline(s). 34 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Karen Alfaro Salazar (ksalazar-91)
left a comment
There was a problem hiding this comment.
Review Summary
I checked out this branch locally, built the module, and ran the affected tests to verify correctness, and compared against the merged .NET counterpart (Azure/azure-sdk-for-net#61559) for parity.
Verified locally:
mvn compile/test-compileclean, no errorscheckstyle:checkclean- New unit tests (
ServiceBusServiceVersionTest,TopicRuntimePropertiesTest, XML round-trip inServiceBusManagementSerializerTest) all pass - Full playback-mode integration suites (
ServiceBusAdministrationClientIntegrationTest45/45,ServiceBusAdministrationAsyncClientIntegrationTest47/47,ServiceBusAdministrationClientImplIntegrationTests5/5) all pass, confirming theV2021_05pin for recorded modes doesn't break existing cassettes - XML element names (
SqlFilterCount/CorrelationFilterCount) match the merged .NET implementation exactly, low risk of a wire-format mismatch ServiceBusServiceVersionis only referenced by the admin client builder, so bumping the default doesn't touch the AMQP data-plane- Author confirmed
getTopicFilterCountsand the2024-05default were also validated against a live Service Bus namespace, addressing correctness of the new behavior end-to-end
Strengths: clean generated-code diff mirroring existing subscriptionCount patterns, good default-to-zero test coverage, correct null-handling via toPrimitive, swagger directive well-documented and consistent with sibling directives in the same file.
Suggestions (non-blocking):
getTopicFilterCountsis@LiveOnly, so it won't automatically re-run in standard CI (PLAYBACK) or even RECORD going forward. Correctness was manually validated live for this PR, but there's currently no automated regression safety net for this path afterward. Consider allowing RECORD mode once a feature-enabled namespace is consistently available, so a cassette can eventually back a PLAYBACK run.- The .NET counterpart PR added a second, explicit CHANGELOG line under "Other Changes" calling out the default administration service-version bump (
2021-05->2024-05) as a behavior change, separate from the "Features Added" bullet. Consider mirroring that here for visibility, since this changes the default wire behavior for all callers who don't pin a version. - Minor nit: the new CHANGELOG bullets don't include a PR reference link (
([#NNNNN](...))), unlike the sibling entry above them in the same section.
Nothing here blocks merge - solid, well-tested, low-blast-radius port of the .NET feature.
- Build the client for getTopicFilterCounts with an explicit ServiceBusServiceVersion.V2024_05 instead of relying on the builder default, matching the merged .NET counterpart. - Add a getClient(ServiceBusServiceVersion) overload that applies the version after configure(), and have the no-arg getClient() delegate to it so the setup is not duplicated. - Correct the comment on why the test is live only: the recorded modes are pinned to 2021-05 to match the existing cassettes, and no cassette covers this path yet.
- Add an Other Changes entry recording that the default service version used by ServiceBusAdministrationClientBuilder moved from 2021-05 to 2024-05, and how callers pin the previous behavior. - Mirrors the merged .NET counterpart, which records the same bump separately from the Features Added bullet.
|
Your RECORD question turned up that the test was taking the builder default, so a recording would have captured zeros. Added the On the reference links, most bullets in this package go without one, 4 of the last 18 content bullets carry one and the .NET bullets carry none, so I have left them off. |
Description
Adds the topic-level
SqlFilterCountandCorrelationFilterCountruntime properties to the Service Bus administration client, porting the merged .NET implementation (Azure/azure-sdk-for-net#61559) to Java.API additions
TopicRuntimeProperties.getSqlFilterCount()andgetCorrelationFilterCount()— the total number of SQL / correlation filters across all of a topic's subscriptions, populated bygetTopicRuntimeProperties/getTopicsRuntimeProperties.ServiceBusServiceVersion.V2024_05, now the latest. The administration client sendsapi-version=2024-05by default, which the service requires to serve the filter counts. Existing operations are unaffected, and callers can still pin an earlier version.Behavior
2024-05service API version and by regions that have deployed the feature. When absent (older api-version or region), they default to0.Code generation
TopicDescriptionvia a swagger directive, because the pinned2021-05input swagger does not yet define them. A regeneration therefore reproduces the fields (verified by runningautorestlocally — the regeneratedTopicDescriptionmatches the committed file). The directive is to be removed once theinput-fileis bumped to a spec revision that defines the properties.Tests
SqlFilterCount == 2(the$DefaultTrueFilter + the explicit SQL rule) andCorrelationFilterCount == 1. Validated against a live namespace.Checklist